<?php $this->load->module('index/index/head', $params);?>
<?php $this->load->module('member/index/center_head');?>


<style>
    .webuploader-pick{background:#fff;color:#666!important;padding:0}
</style>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="breadcrumb-box">
                    <span class="breadcrumb-new-style">您所在的位置：</span>
                    <ol class="breadcrumb ol-bgc">
                        <li><a href="<?php echo site_url('member/index/center')?>">会员中心</a></li>
                        <li class="active">我的信息</li>
                    </ol>
                </div>
            </div>
            <?php $this->load->module('member/index/center_left',$extra);?>

            <div class="col-md-9 member-center-box-margin">
                <form  method="post" class="formvalidate form-horizontal" action="<?php echo $form_url;?>">
                    <div class="no-radius-border persona-info-title">
                        <div class="persona-info-title-img text-center">
                            <img id="avatar_box" src="<?php if(empty($avatar)):
                                echo URLPRE.'static/template/default/images/txiao.jpg';
                            else:
                                echo URLPIC.$avatar.'?_='.time() ;
                            endif;
                            ?>">
                            <a class="help-block" id="filePicker">编辑</a>
                        </div>
                        <div class="col-md-8 ">
                            <div class="persona-info-title-txt"><?php echo $username?></div>
                        </div>
                    </div>
                    <div class="persona-info-container no-radius-border">
                        <div class="form-group">
                            <label class="col-md-2 control-label">昵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</label>
                            <div class="col-md-4">
                                <input class="form-control" name="Form[username]" type="text" value="<?php echo $username?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">真实姓名</label>
                            <div class="col-md-4">
                                <input class="form-control" name="Expand[realname]" type="text" value="<?php echo $realname ;?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">证件号码</label>
                            <div class="col-md-2">
                                <select class="form-control" name="Expand[id_type]" id="id_type">
                                    <option value="1" <?php if($id_type==1){echo 'selected';}?>>身份证</option>
                                    <option value="2" <?php if($id_type==2){echo 'selected';}?>>护照</option>
                                    <option value="3" <?php if($id_type==3){echo 'selected';}?>>军官证</option>
                                    <option value="4" <?php if($id_type==4){echo 'selected';}?>>驾驶证</option>
                                    <option value="5" <?php if($id_type==5){echo 'selected';}?>>其它</option>
                                </select>
                            </div>
                            <div class="col-md-5">
                                <input class="form-control" type="text"  name="Expand[id_num]" id="id_num" value="<?php echo $id_num?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">手机号码</label>
                            <div class="col-md-4">
                                <input class="form-control" type="text" value="<?php echo $mobile?>" readonly>
                            </div>
                            <div class="col-md-2">
                                <label class="control-label">
                                    <a class="persona-info-a-color" href="<?php echo site_url('member/index/modify_mobile')?>">修改>></a>
                                </label>
                            </div>
                        </div>
<!--                        <div class="form-group">-->
<!--                            <label class="col-md-2 control-label">电子邮箱</label>-->
<!--                            <div class="col-md-4">-->
<!--                                <input class="form-control" type="email" value="--><?php //echo $email?><!--" readonly>-->
<!--                            </div>-->
<!--                            <div class="col-md-2">-->
<!--                                <label class="control-label">-->
<!--                                    <a class="persona-info-a-color" href="--><?php //echo site_url('member/index/modify_email')?><!--">修改>></a>-->
<!--                                </label>-->
<!--                            </div>-->
<!---->
<!--                        </div>-->
                        <div class="form-group">
                            <label class="col-md-2 control-label">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别</label>
                            <div class="col-md-4">
                                <label class="radio-inline">
                                    <input type="radio" name="Expand[gender]" id="inlineRadio1" value="1" <?php if($gender==1){echo 'checked';}?>>男
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="Expand[gender]" id="inlineRadio2" value="2" <?php if($gender==2){echo 'checked';}?>> 女
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;业</label>
                            <div class="col-md-4">
                                <select class="form-control" name="Expand[zhiye]">
                                    <option value="0" <?php if($zhiye==0){echo 'selected';}?>>请选择职业</option>
                                    <option value="1" <?php if($zhiye==1){echo 'selected';}?>>学生</option>
                                    <option value="2" <?php if($zhiye==2){echo 'selected';}?>>军人</option>
                                    <option value="3" <?php if($zhiye==3){echo 'selected';}?>>公务员</option>
                                    <option value="4" <?php if($zhiye==4){echo 'selected';}?>>公司职员</option>
                                    <option value="5" <?php if($zhiye==5){echo 'selected';}?>>自由职业者</option>
                                    <option value="6" <?php if($zhiye==6){echo 'selected';}?>>其它</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">出生日期</label>
                            <div class="col-md-2">
                                <select class="form-control" id="birthyear" onchange="showbirthday()">
                                    <?php for($i=date('Y'); $i>1910; $i --){?>
                                    <option value="<?php echo $i?>"><?php echo $i?>年</option>
                                    <?php }?>
                                </select>
                            </div>
                            <div class="col-md-2">
                                <select class="form-control" id="birthmonth" onchange="showbirthday()">
                                    <?php for($i=1; $i<=12; $i++){?>
                                    <option value="<?php echo $i?>"><?php echo $i?>月</option>
                                    <?php }?>
                                </select>
                            </div>
                            <div class="col-md-2">
                                <select class="form-control" id="birthday" onchange="showbirthday()">
                                    <?php for($i=1; $i<=31; $i++){?>
                                        <option value="<?php echo $i?>"><?php echo $i?>日</option>
                                    <?php }?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">QQ号码</label>
                            <div class="col-md-4">
                                <input class="form-control" name="Expand[qq]" type="text" value="<?php echo $qq?>">
                            </div>
                        </div>
                        <input type="hidden" name="user_id" value="<?php echo $user_id ;?>">
                        <button class="col-md-2 col-md-offset-2 btn btn-primary " type="submit">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
<script>
    function $_(id){
        return document.getElementById(id);
    }

    /**
     * 身份证号码验证
     *
     */
    function isIdCardNo(num) {

        var factorArr = new Array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1);
        var parityBit=new Array("1","0","X","9","8","7","6","5","4","3","2");
        var varArray = new Array();
        var intValue;
        var lngProduct = 0;
        var intCheckDigit;
        var intStrLen = num.length;
        var idNumber = num;
        // initialize
        if ((intStrLen != 15) && (intStrLen != 18)) {
            return false;
        }
        // check and set value
        for(i=0;i<intStrLen;i++) {
            varArray[i] = idNumber.charAt(i);
            if ((varArray[i] < '0' || varArray[i] > '9') && (i != 17)) {
                return false;
            } else if (i < 17) {
                varArray[i] = varArray[i] * factorArr[i];
            }
        }

        if (intStrLen == 18) {
            //check date
            var date8 = idNumber.substring(6,14);
            if (isDate8(date8) == false) {
                return false;
            }
            // calculate the sum of the products
            for(i=0;i<17;i++) {
                lngProduct = lngProduct + varArray[i];
            }
            // calculate the check digit
            intCheckDigit = parityBit[lngProduct % 11];
            // check last digit
            if (varArray[17] != intCheckDigit) {
                return false;
            }
        }
        else{//length is 15
            //check date
            var date6 = idNumber.substring(6,12);
            if (isDate6(date6) == false) {

                return false;
            }
        }
        return true;

    }

    function showbirthday(){
        var el = $_('birthday');
        var birthday = el.value;
        el.length=0;
//        el.options.add(new Option('日', ''));
        for(var i=0;i<28;i++){
            el.options.add(new Option(i+1+'日', i+1));
        }
        if($_('birthmonth').value!="2"){
            el.options.add(new Option(29+'日', 29));
            el.options.add(new Option(30+'日', 30));
            switch($_('birthmonth').value){
                case "1":
                case "3":
                case "5":
                case "7":
                case "8":
                case "10":
                case "12":{
                    el.options.add(new Option(31+'日', 31));
                }
            }
        } else if($_('birthyear').value!="") {
            var nbirthyear=$_('birthyear').value;
            if(nbirthyear%400==0 || (nbirthyear%4==0 && nbirthyear%100!=0)) el.options.add(new Option(29+'日', 29));
        }
        el.value = birthday;
    }
</script>

    <script type="text/javascript">
        upload_image("<?php echo site_url('member/index/upload_avatar');?>",'filePicker','face_image','avatar_box');
    </script>

<?php $this->load->module('index/index/foot');?>